package com.itlong.cloud.service.impl;

import com.itlong.cloud.POJO.PO.TimeTaskParkingErrorOrderPO;
import com.itlong.cloud.PlatformConstants;
import com.itlong.cloud.dao.ITimeTaskParkingErrorOrderDao;
import com.itlong.cloud.service.ITimeTaskParkingErrorOrderService;
import com.itlong.cloud.utils.data.handler.SqlUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <desc>
 *      停车场业务指令结果信息处理接口实现类
 * </desc>
 *
 * @createDate 2018/11/15
 */
@Service
public class TimeTaskParkingErrorOrderServiceImpl implements ITimeTaskParkingErrorOrderService{
    @Autowired
    ITimeTaskParkingErrorOrderDao iTimeTaskParkingErrorOrderDao;

    /**
     * <desc>
     *      添加执行结果
     * </desc>
     *
     * @param po
     * @return
     * @author Jiaqi.X
     * @createDate 2018/11/15
     */
    @Override
    public Integer save(TimeTaskParkingErrorOrderPO po) throws Exception {
        return iTimeTaskParkingErrorOrderDao.save(SqlUtil.durableData(po, PlatformConstants.TABLE_SAVE));
    }

    /**
     * <desc>
     *      获取执行失败的指令
     * </desc>
     *
     * @return
     * @author Jiaqi.X
     * @createDate 2018/11/15
     */
    @Override
    public List<TimeTaskParkingErrorOrderPO> getUntreatedErrors() {
        return iTimeTaskParkingErrorOrderDao.getUntreatedErrors();
    }

    /**
     * <desc>
     *      将处理状态改为已处理
     * </desc>
     *
     * @param errorIds
     * @return
     * @author Jiaqi.X
     * @create 2018/11/15
     */
    @Override
    public Integer setDataStatusSuccess(String errorIds) {
        return iTimeTaskParkingErrorOrderDao.setDataStatusSuccess(errorIds.split(","));
    }
}
